User accessrights by way of get-mailboxpermission script -> SQL Table
I am working on an Office 365 migration project and I need to export all user data and do an audit of full access, send as and such. I am using the get-mailboxpermission cmdlet. The problem I am encountering is the accessrights. I would
like to split this array and load each of them into its own line in a table; I can't figure out how to do this...
Please excuse if this code looks a little shabby, I have been fighting with it for hours...
$user = "user"
$permparse = Get-MailboxPermission $user
foreach ($line in $permparse)
{
$isinherited = $line.isinherited
$Deny = $line.deny
$InheritanceType = $line.InheritanceType
$Identity = $line.Identity
$IsValid = $line.IsValid
$ObjectState = $line.ObjectState
$accessrights = $line.AccessRights
Write-Host $accessright - $user
foreach ($rights in $accessrights)
{
$rights = $rigts.split(",")
foreach ($right in $rights)
{
Write-host $right
}
}
}
April 24th, 2012 4:56pm
Hi,
Sorry but I did not understand actually what you are trying to achieve actually but I have written a reporting script a while ago for Mailbox Permissions that you can find in TechNet Script Repository. Look at the code and it might give you an idea.
http://gallery.technet.microsoft.com/scriptcenter/Generate-HTML-Report-for-da0f5132
Thanks
Get-Mailbox.org
Free Windows Admin Tool Kit Click here and download it now
April 24th, 2012 7:53pm
Hi
Get-MailboxPermission $user |select isinherited,deny,Inheritancetype,identity,isValid | export-csv a.csvTerence Yu
TechNet Community Support
April 25th, 2012 8:42pm